@class CQChatRoomController;
@class CQDirectChatController;
@class MVChatConnection;
@class MVChatRoom;
@class MVChatUser;
@class MVDirectChatConnection;

@interface CQChatController : NSObject {
	@private
	NSMutableArray *_chatControllers;

	UIWindow *_chatsWindow;
	UINavigationBar *_navigationBar;
	UITableView *_chatsSectionList;
	UIToolbar *_buttonBar;
	UIView *_mainView;
	id _currentChatViewController;

	BOOL _showingChat;
	BOOL _editingList;
	unsigned _badgeNumber;
}
+ (CQChatController *) defaultController;

- (UIWindow *) chatsWindow;
- (UINavigationBar *) navigationBar;
- (UIToolbar *) buttonBar;

- (void) showChatsWindow;

- (void) updateApplicationBadge;
- (void) clearApplicationBadge;
- (void) incrementApplicationBadgeByAmount:(unsigned) amount;
- (void) decrementApplicationBadgeByAmount:(unsigned) amount;

- (NSArray *) allChatViewControllers;
- (NSArray *) chatViewControllersWithConnection:(MVChatConnection *) connection;
- (NSArray *) chatViewControllersOfClass:(Class) class;
- (NSArray *) chatViewControllersKindOfClass:(Class) class;

- (CQChatRoomController *) chatViewControllerForRoom:(MVChatRoom *) room ifExists:(BOOL) exists;
- (CQDirectChatController *) chatViewControllerForUser:(MVChatUser *) user ifExists:(BOOL) exists;
- (CQDirectChatController *) chatViewControllerForUser:(MVChatUser *) user ifExists:(BOOL) exists userInitiated:(BOOL) requested;
- (CQDirectChatController *) chatViewControllerForDirectChatConnection:(MVDirectChatConnection *) connection ifExists:(BOOL) exists;

- (void) closeViewController:(id) controller;
@end
